<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>键盘：keydown 和 keyup</title>
	</head>
	<body>
		键盘：keydown 和 keyup

		<script>
			// 键盘按下
			document.addEventListener('keydown', function (event) {
				console.log('keydown', event)
			})

			// 键盘抬起
			document.addEventListener('keyup', function (event) {
				console.log('keyup', event)
			})
		</script>
	</body>
</html>
